﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ProjectManagement
{
    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.3038")]
    [System.SerializableAttribute()]
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    [System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)]
    public class Project
    {
        #region Vars and Properties

        private string _name;
        private string _path;
        private Guid _projectGuid;

        [System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
        public string Name
        {
            get { return _name; }
            set { _name = value; }
        }

        [System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
        public string Path
        {
            get { return _path; }
            set { _path = value; }
        }

        [System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
        public Guid ProjectGuid
        {
            get { return _projectGuid; }
            set { _projectGuid = value; }
        }

        #endregion

        #region Constructors


        public Project()
        { }

        public Project(string name, string path, Guid projectGuid)
        {
            this.Name = name;
            this.Path = path;
            this.ProjectGuid = projectGuid;
        }

        public Project(string name, string path, string projectGuid)
        {
            try
            {
                this.Name = name;
                this.Path = path;
                Guid currentGuid = Guid.Parse(projectGuid);
            }
            catch (InvalidCastException ex)
            {
                throw new Exception("Error al convertir el guid.", ex);
            }
        }
        #endregion

        #region Methods

        public static Project CreateProject(string name, string path)
        {
            return new Project(name, path, System.Guid.NewGuid()); ;
        }
        #endregion
    }
}
